<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>浏览器打开标签页</title>
</head>
<body>
    <button id="btn">打开链接</button>
    <button id="btn1">关闭当前页面</button>
    <script>
        btn.onclick = function(){
            // location.href="https://www.baidu.com"
            window.open("https://www.baidu.com")
            window.close()
        }
        btn1.onclick = function(){
            window.close()
        }
    </script>
</body>
</html>